import { reqGetCategoryList, reqGetBanners,reqGetFloors } from "../../api/home"

const state = {
  categoryList: [],
  banners: [],
  floors: [],
}
const getters = {}
const actions = {
  async getCategoryList({ commit }) {
    const data = await reqGetCategoryList()

    commit("GET_CATEGORY_LIST", data)
  },
  async getBanners({ commit }) {
    const data = await reqGetBanners()
    commit("GET_BANNERS", data)
  },
  async getFloors({ commit }) {
    const data = await reqGetFloors()
    commit("GET_FLOORS", data)
  },
}
const mutations = {
  GET_CATEGORY_LIST(state, categoryList) {
    state.categoryList = categoryList
  },
  GET_BANNERS(state, banners) {
    state.banners = banners
  },
  GET_FLOORS(state, floors) {
    state.floors = floors
  },
}

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations,
}
